# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

    def date_from_db(date = nil)
      if(date != nil)
    		french_date = date.to_s
    		french_date = french_date[8..9] + "/" + french_date[5..6] + 
    			"/" + french_date[0..3] + " - " + french_date[11..12] + "h" +
    			french_date[14..15] + "min"
    	else
    	  french_date = "---"
    	end
    end
	
	  def date_alone(date)
		  date_a = date.to_s
	    date_a = date_a[8..9] + "-" + date_a[5..6] +  "-" + date_a[0..3]
    end
  
    def hour_alone(date)
		hour_a = date.to_s
		hour_a = hour_a[11..12] + "h" + hour_a[14..15] 
    end
	
	def valid_date(dateStart)
		checkDateStart = dateStart.to_s
		
		if(checkDateStart[4..4] == "-" && checkDateStart[7..7] == "-")
			return true
		else
			return false
		end
	end
	
end
